const BASE_URL = 'http://localhost:3000'
const $http=(({url,method="get",data={}})=>{
  let promise= new Promise((resolve,reject)=>{
    wx.request({
      url:BASE_URL+url,
      method,
      data:data,
      success(res){ resolve(res) },
      fail(err){ reject(err) }
    })
  })
  return promise
})
const $post=(url,data)=>{
  return $http({url,method:'POST',data})
}
module.exports={
  $http,
  $post
}
